package com.katydid.util;

import java.util.logging.Logger;

import javax.inject.Inject;
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;

@Loggable
@Interceptor
public class LogInterceptor {
	
	@Inject
	private Logger logger;

	@AroundInvoke
	public Object log(InvocationContext ic) throws Exception {
		if (logger != null) {   // why @produces injection not working??
			logger.info("AuditLog - About to execute method: " + ic.getMethod());
		}
		Object result = ic.proceed();
		return result;
	}
}
